package com.njbdqn.qiy_shop.shopcontroller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.njbdqn.qiy_shop.shopservices.ChaKanGouWuCheService;
import com.njbdqn.qiy_shop.shopservices.OutputService;
import com.njbdqn.qiy_shop.shopvo.ChaKanGouWuCheVO;
import com.njbdqn.qiy_shop.utils.ReturnUtil;

/**
 * Servlet implementation class QingKongController
 */
public class QingKongController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			HttpSession session = request.getSession();
			ChaKanGouWuCheVO buy = (ChaKanGouWuCheVO) session.getAttribute("buy");
			ChaKanGouWuCheService bs = new ChaKanGouWuCheService(buy);
			bs.clearShop();
			OutputService.out(response, ReturnUtil.SUCCESS);
		} catch (Exception e) {
			OutputService.out(response, ReturnUtil.PARAMERROR);
		}
	}

}
